package myadmin.jtthink.com.MyQuery;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import myadmin.jtthink.com.Mapper.BooksMapper;
import myadmin.jtthink.com.Models.BookList;
import myadmin.jtthink.com.Models.BookModel;
import myadmin.jtthink.com.Models.PageInfo;
import myadmin.jtthink.com.MyServices.IBook;
import org.springframework.stereotype.Component;

@Component
public class BookQuery extends ServiceImpl<BooksMapper, BookModel>
        implements IBook,GraphQLQueryResolver {
    public BookList list(int page, int size){
        System.out.println(size);
        Page<BookModel> p=new Page<>(page,size);
       return new BookList(this.page(p).getRecords(),
               PageInfo.build(p.getTotal(),p.getSize(),p.getCurrent()));
     }


}
